package com.zhu.service.edu.controller.Front;


import com.zhu.commons.utils.R;
import com.zhu.service.edu.pojo.EduTeacher;
import com.zhu.service.edu.service.IEduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("api/front/teacher")
@Api(tags = "教师前端api")
//@CrossOrigin
public class TeacherFrontApi {

    @Autowired
    private IEduTeacherService teacherService;

    @GetMapping("list")
    @ApiOperation(value = "讲师列表")
    public R teacherList(){
        List<EduTeacher> list = teacherService.list();
        return R.ok().data("items",list);
    }

    @GetMapping("teacherInfo/{id}")
    @ApiOperation(value = "讲师列表")
    public R getTeacherInfo(@PathVariable("id") String id){
    Map<String,Object> teacherInfo=teacherService.selectTeacherInfo(id);
    if(teacherInfo!=null){
        return R.ok().data("item",teacherInfo);
    }
        return R.error().message("教师信息不存在！");
    }
}
